#include <assert.h>
#include <locale.h>
#include "string-utility.h"

wchar_t test_1[] = L" 0345 43";
wchar_t test_2[] = L"034543";
wchar_t test_3[] = L"versucht,";
wchar_t test_4[] = L"abcdAbc";
wchar_t test_5[] = L"(Änderung)";
wchar_t test_6[] = L"Achtung!";
wchar_t test_7[] = L"";
wchar_t test_8[] = L"token ";
wchar_t test_9[] = L"wörtlich";
wchar_t test_10[] = L"Kalium-40";
wchar_t test_11[] = L"40, 184, 39";

int main(void) {
    setlocale(LC_ALL, "");

    wcsrmbydfn(test_1, iswblank);
    assert(wcscmp(test_1, L"034543") == 0);

    wcsrmbydfn(test_2, iswblank);
    assert(wcscmp(test_2, L"034543") == 0);

    wcsrmbydfn(test_3, iswpunct);
    assert(wcscmp(test_3, L"versucht") == 0);

    wcsrmbydfn(test_4, iswlower);
    assert(wcscmp(test_4, L"A") == 0);

    wcsrmbydfn(test_5, iswpunct);
    assert(wcscmp(test_5, L"Änderung") == 0);

    assert(wcseosdfn(test_6, iswpunct) == 1);
    assert(wcseosdfn(test_7, iswdigit) == 0);
    assert(wcseosdfn(test_8, iswblank) == 1);

    assert(wcssatdfn(test_9, iswalpha) == 1);
    assert(wcssatdfn(test_10, iswalpha) == 0);
    assert(wcssatdfn(test_11, iswalpha) == -1);

    assert(wcspfx(L"Präfixstring", L"") == 1);
    assert(wcspfx(L"Präfixstring", L"P") == 1);
    assert(wcspfx(L"Präfixstring", L"Präfix") == 1);
    assert(wcspfx(L"Präfixstring", L"Präfixstring") == 1);
    assert(wcspfx(L"", L"") == 1);
    assert(wcspfx(L"", L"A") == 0);
    assert(wcspfx(L"", L"Text") == 0);
    assert(wcspfx(L"System", L"F") == 0);

    assert(wcssfx(L"", L"") == 1);
    assert(wcssfx(L"Test", L"") == 1);
    assert(wcssfx(L"", L"O") == 0);
    assert(wcssfx(L"Mitarbeiterin", L"in") == 1);
    assert(wcssfx(L"String", L"String") == 1);
    assert(wcssfx(L"", L"A") == 0);
    assert(wcssfx(L"", L"Text") == 0);

    assert(strpfx("Prefixstring", "") == 1);
    assert(strpfx("Prefixstring", "P") == 1);
    assert(strpfx("Prefixstring", "Prefix") == 1);
    assert(strpfx("Prefixstring", "Prefixstring") == 1);
    assert(strpfx("", "") == 1);
    assert(strpfx("", "A") == 0);
    assert(strpfx("", "Text") == 0);
    assert(strpfx("System", "F") == 0);
}